package com.java.file.controller.admin;

import com.java.common.utils.PageUtils;
import com.java.common.utils.R;
import com.java.file.entity.FileEntity;
import com.java.file.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;



/**
 * 文件
 *
 * @author jl
 * @since 2020-10-07 10:31:35
 */
@RestController
@RequestMapping("admin/file")
public class FileController {
    @Autowired
    private FileService fileService;

    /**
     * 带条件分页查询文件
     */
    @PostMapping("/list")
    public R list(@RequestBody Map<String, Object> params){
        PageUtils page = fileService.queryPage(params);

	    return R.ok(page);
    }

    /**
     * 根据主键查询文件
     */
    @GetMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
		FileEntity file = fileService.getById(id);

        return R.ok(file);
    }
}
